package com.ruoyi.fly.service.impl;

import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.fly.domain.ChlLbt;
import com.ruoyi.fly.domain.vo.ChlLbtSearchVo;
import com.ruoyi.fly.domain.vo.ChlLbtVo;
import com.ruoyi.fly.mapper.ChlLbtMapper;
import com.ruoyi.fly.service.ChlLbtService;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ChlLbtServiceImpl implements ChlLbtService {

    @Autowired
    private ChlLbtMapper chlLbtMapper;

    @Override
    public List<ChlLbt> selectLbtList(ChlLbtSearchVo chlLbtSearchVo) {
        return chlLbtMapper.selectLbtList(chlLbtSearchVo);
    }

    @Override
    public ChlLbt selectLbtById(String id) {
        return chlLbtMapper.selectLbtById(id);
    }

    @Override
    public R addlbt(ChlLbt chlLbt) {
        chlLbt.setCreateUser(SecurityUtils.getUserId());
        return chlLbtMapper.insertLbt(chlLbt) > 0 ? R.ok("新增成功") : R.fail("操作失败");
    }

    @Override
    public R editLbt(ChlLbt chlLbt) {
        chlLbt.setUpdateUser(SecurityUtils.getUserId());
        return chlLbtMapper.updateLbt(chlLbt) > 0 ? R.ok("修改成功") : R.fail("操作失败");
    }

    @Override
    public R deletelbt(String id) {
        return chlLbtMapper.deleteLbtById(id) > 0 ? R.ok("删除成功") : R.fail("操作失败");
    }

    @Override
    public R deleteLbtByIds(String[] ids) {
        return chlLbtMapper.deleteLbtByIds(ids) > 0 ? R.ok("删除成功") : R.fail("操作失败");
    }
}
